package com.geeyuu.android.service;

/**
 * 所有命令最大不能超过65535
 * @author Alex
 *
 */
public class ProtocolCommand {
    
    // 推送包
    private static final int CMD_PUSH = 5000;
    // 三大系统
    private static final int CMD_USER_SYSTEM = 10000;
    private static final int CMD_SOCIAL_SYSTEM = 20000;
    private static final int CMD_IM_SYSTEM = 30000;
    // ===================================================================================

    // 用户系统
    // 请求/应答包：
    public static final int CMD_REGISTER = (CMD_USER_SYSTEM + 1);
    public static final int CMD_LOGIN = (CMD_USER_SYSTEM + 2);
    public static final int CMD_MODIFY_PASSWORD = (CMD_USER_SYSTEM + 3);
    public static final int CMD_SET_PHOTO = (CMD_USER_SYSTEM + 4);
    public static final int CMD_SET_MY_USER_INFO = (CMD_USER_SYSTEM + 5);
    public static final int CMD_INVITE_FOR_REGISTER = (CMD_USER_SYSTEM + 6);
    public static final int CMD_OFFLINE_RESET_PASSWORD = (CMD_USER_SYSTEM + 7);
    public static final int CMD_GET_MY_USERNAME = (CMD_USER_SYSTEM + 8);
    // ===================================================================================

    // 社交系统
    // 请求/应答包
    public static final int CMD_QUERY_USER_BASE_INFO = (CMD_SOCIAL_SYSTEM + 1);
    public static final int CMD_QUERY_GROUP_USER_BASE_INFO = (CMD_SOCIAL_SYSTEM + 2);
    public static final int CMD_QUERY_USER_INFO = (CMD_SOCIAL_SYSTEM + 3);
    public static final int CMD_QUERY_USER_EXT_INFO = (CMD_SOCIAL_SYSTEM + 4);
//    public static final int CMD_QUERY_AROUND_USERS = (CMD_SOCIAL_SYSTEM + 5);
    public static final int CMD_SET_INTEREST = (CMD_SOCIAL_SYSTEM + 6);
    public static final int CMD_SET_BLACK = (CMD_SOCIAL_SYSTEM + 7);
    public static final int CMD_QUERY_MY_USER_LIST = (CMD_SOCIAL_SYSTEM + 8);
    public static final int CMD_QUERY_MY_FANS = (CMD_SOCIAL_SYSTEM + 9);
    public static final int CMD_QUERY_ALBUM = (CMD_SOCIAL_SYSTEM + 10);
    public static final int CMD_ADD_TO_ALBUM = (CMD_SOCIAL_SYSTEM + 11);
    public static final int CMD_SEND_FLOWER = (CMD_SOCIAL_SYSTEM + 12);
    public static final int CMD_REPORT = (CMD_SOCIAL_SYSTEM + 13);
    public static final int CMD_QUERY_AROUND_USERS_28_SIZE = (CMD_SOCIAL_SYSTEM + 14);
    // 共享私照模块
    public static final int CMD_INVATE_FOR_SHARE = (CMD_SOCIAL_SYSTEM + 101);
    public static final int CMD_RESPONSE_FOR_SHARE = (CMD_SOCIAL_SYSTEM + 102);
    public static final int CMD_RELEASE_SHARE = (CMD_SOCIAL_SYSTEM + 103);
    // 摇一摇
    public static final int CMD_SHAKE_SHAKE = (CMD_SOCIAL_SYSTEM + 104);
    // 偶遇模块
    public static final int CMD_REPORT_LOCATION = (CMD_SOCIAL_SYSTEM + 201);
    // ===================================================================================

    // IM系统
    // 请求/应答包
    public static final int CMD_SEND_CHAT_MSG = (CMD_IM_SYSTEM + 1);
    public static final int CMD_PRIVATE_MSG_RECEIVED = (CMD_IM_SYSTEM + 2);
    public static final int CMD_SYSTEM_MSG_RECEIVED = (CMD_IM_SYSTEM + 3);
    public static final int CMD_HEART_BEAT = (CMD_IM_SYSTEM + 4);
    public static final int CMD_REMOVE_CHAT_MSG_RECORD = (CMD_IM_SYSTEM + 5);
    
    
    // ====================================================================================
    
    // 推送包                    
    public static final int CMD_CHAT_MSG_NOTIFICATION = (CMD_SOCIAL_SYSTEM + CMD_PUSH + 1);
    public static final int CMD_SYSTEM_MSG_NOTIFICATION = (CMD_SOCIAL_SYSTEM + CMD_PUSH + 2);
    
// // 用户系统
//    #define SYSTEM_MSG_TYPE_LOGIN_CONFLICT 10001    // 别处登录通知
//    #define SYSTEM_MSG_TYPE_MONEY 10002 // 财富通知
//
//    // 社交系统
//    #define SYSTEM_MSG_TYPE_NEW_FANS 20001  // 被关注
//    #define SYSTEM_MSG_TYPE_RELEASE_SHARE 20002 // 被解除共享关系
//    #define SYSTEM_MSG_TYPE_NEW_VISITOR 20003       // 新增访客
//    #define SYSTEM_MSG_TYPE_ACROSS_INFO 20004   // 偶遇信息
//    #define SYSTEM_MSG_TYPE_GOT_FLOWER 20005 // 收到送花
//
//    // IM系统
//    #define SYSTEM_MSG_TYPE_COMMON 30001
    
    /**
     * 添加推送命令需要修改此方法
     * @param cmd
     * @return
     */
    public static boolean isPushCommand(int cmd){
        if(cmd == CMD_CHAT_MSG_NOTIFICATION){
            return true;
        }
        if(cmd == CMD_SYSTEM_MSG_NOTIFICATION){
            return true;
        }
        return false;
    }
    
    // ====================================================================================
    
    public static final int CMD_ERROR_NONE = 0;   // 无错误
    public static final int CMD_ERROR_UNKNOWN = 1; // 未知错误
    public static final int CMD_ERROR_SERVER_BUSY = 2; // 服务器繁忙
    public static final int CMD_ERROR_CLIENT_BUG = 3;  // 数据包异常
    public static final int CMD_ERROR_OUT_OF_REACH = 4;   // 未能到达，权限不够
    public static final int CMD_ERROR_TOUCH_TOP = 5;   // 已到达最大值
    public static final int CMD_ERROR_NO_DATA = 6;   // 无可用数据返回
    public static final int CMD_ERROR_TIMEOUT = 7; // 已过期
    public static final int CMD_ERROR_OUT = 8; // 要求离开
    public static final int CMD_ACCOUNT = 9; // 注册帐号已存在
    //==========================================================================================
    
    /**
     * 最大不能超过65535
     */
    public static final int PROTOCOL_VERSION = 1;
    public static final int MIN_COMMAND = CMD_PUSH;
    /**
     * 添加新的命令切记更改此值
     */
    public static final int MAX_COMMAND = CMD_REMOVE_CHAT_MSG_RECORD;
    public static final int MIN_ERROR_CMD = CMD_ERROR_NONE;
    /**
     * 添加新的错误类型切记更改此值
     */
    public static final int MAX_ERROR_CMD = CMD_ACCOUNT;

}
